//////////////////
/// mkI - Base ///
//////////////////

#pragma once

// Base includes
#include "../../Base/mkBaseDeclare.h"

#ifdef MK_PLATFORM_WIN
#   define mkDebugBreak __debugbreak()
#endif

#ifdef MK_DEBUG
#   define mkTrace( format, ... ) mk::Trace( format, ##__VA_ARGS__ )
#else
#   define mkTrace( format, ... )
#endif

namespace mk
{
    enum AssertResult
    {
        AssertResult_Abort,             //!< Debug break immediately.
        AssertResult_Retry,             //!< Continue and ignore the assert this one time.
        AssertResult_Ignore,            //!< Ignore the assert.
    };
} // namespace mk

#ifdef MK_DEBUG
#   define mkAssert( condition, format, ... )                                                                                               \
{                                                                                                                                           \
    mk::AssertResult result = ::mk::Assert( #condition, __FUNCTION__,  __FILE__, static_cast<::mk::uint>(__LINE__), format, ##__VA_ARGS__ );\
    if( result == mk::AssertResult_Abort )                                                                                                  \
    {                                                                                                                                       \
        mkDebugBreak;                                                                                                                       \
    }                                                                                                                                       \
}
#else
#   define mkAssert( condition, format, ... )
#endif

namespace mk
{

void Trace           ( char const* format, ... ) MK_NOEXCEPT;
void TraceUnformatted( char const* format, ... ) MK_NOEXCEPT;

AssertResult Assert( char const* condition, char const* function, char const* filePath, uint const line, char const* format, ... ) MK_NOEXCEPT;

} // namespace mk

